﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MVCUIPlugins.Templates
{
    public static class DeleteTemplate
    {

        public static string DeletePopUpBootstrapTemplate(string gridName, string submitUrl, string closeName, string deleteButtonName)
        {
            string template= String.Format(@"<div id='{0}DeletePopup' class='modal hide fade'>
                                  <div class='modal-header'>
                                    <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>
                                    <h3>Delete confirmation</h3>
                                  </div>
                                  <div class='modal-body'>
                                    <form name='{0}DeleteForm' id='{0}DeleteForm' style='display:none;' action='{1}' method='post'>
                                        <input type='text' name='deleteid' id='deleteid' value='' />
                                    </form>
                                  </div>
                                  <div class='modal-footer'>
                                    <a href='javascript: $(""#{0}DeletePopup"").modal(""hide""); void(0); ' class='btn'>Close</a>
                                    <a href='javascript:  document.{0}DeleteForm.submit(); $(""#{0}DeletePopup"").modal(""hide""); void(0); '  class='btn btn-primary'>Delete record</a>
                                  </div>
                                </div>
                                <script type='text/javascript'>
                                            $('#{0} tr #{0}DeleteButton').click(function () {{
                                                var id = $(this).parent().parent().attr('id');
                                                $('#{0}DeleteForm #deleteid').val(id);
                                                $('#{0}DeletePopup').modal();
                                            }});
                                    
                                </script>", gridName, submitUrl); ;

            return template;

        }






    }
}
